import { createRouter, createWebHistory } from 'vue-router'
import { routes } from './router'
// import { userStore } from '@/stores/user'
// import { checkEnv } from '@/api/checkEnv';

const router = createRouter({
  history: createWebHistory(),
  routes:routes
})

/**
 * 全局钩子
 *
 * @param {Object} to 目标路由
 * @param {Object} from 当前路由
 * @param {Function} next 回调函数
 */
router.beforeEach((to, from, next)=> {
  // const user = userStore()
  // if (!user.isLogin && to.path !== '/login' && checkEnv() !== 'isLocal') {
  //   next('/login')
  //   return
  // }
  // next('/check')
  next()
})

export default router